/*
import java.util.Arrays;

class testMethod{
    public int[] elem;//用来存放数据元素
    public int usedSize;//代表当前顺序表中的存放数据个数
    public static final int DEFAULT_SIZE  = 2;
    public testMethod(){
        this.elem = new int[DEFAULT_SIZE];
    }
    public testMethod(int initCapacity){
        this.elem = new int[initCapacity];
    }


    //打印书序表
    public void display(){
        for(int i = 0;i < this.usedSize;i++){
            System.out.print(this.elem[i] + " ");
        }
    }

    //判断数组存没存满
    public boolean isFull(){
        if(this.usedSize == this.elem.length){
            return true;
        }
        return false;
    }

    //如果存满，就扩容
    public void add(int data){
        if(isFull()) {
            this.elem = Arrays.copyOf(this.elem, 2 * this.elem.length);
        }
        this.elem[this.usedSize] = data;
        this.usedSize++;
    }

    public void addPlus(int pos,int data){
        //判断pos是否合法
        if(pos < 0 || pos > this.usedSize){
            System.out.println("位置不合法");
            return;
        }
        //判断数组是否存满
        if(isFull()) {
            this.elem = Arrays.copyOf(this.elem, 2 * this.elem.length);
        }
        for(int i = this.usedSize - 1 ; i >= pos ; i--){
            this.elem[i+1] = this.elem[i];
        }
        this.elem[pos] = data;
        this.usedSize++;
    }
}

public class dmeo2 {
    public static void main(String[] args) {
        testMethod testMethod1 = new testMethod();
        testMethod1.add(1);
        testMethod1.add(2);
        testMethod1.add(3);
        testMethod1.addPlus(0,1);
        testMethod1.addPlus(0,2);
        testMethod1.display();

    }
}
*/
